<template>
    <div class="cl6">
        <div class="iHead1">安全生产情况统计</div>
        <div class="main">
            <div class="m-i">
                <img class="m-ii1" src="@/assets/11.webp" alt="">
                <img class="m-ii2" src="@/assets/12.webp" alt="">
                <img class="m-ii3" src="@/assets/tab.png" alt="">
                <p>{{ mainData[0] }}</p>
                <span>事故发生数</span>
            </div>
            <div class="m-i">
                <img class="m-ii1" src="@/assets/11.webp" alt="">
                <img class="m-ii2" src="@/assets/12.webp" alt="">
                <img class="m-ii3" src="@/assets/tab.png" alt="">
                <p>{{ mainData[1] }}</p>
                <span>死亡人数</span>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props: ['infoData', 'posItem', 'yearItem'],
    data() {
        return {
            mainData: []
        }
    },
    watch: {
        posItem: function (infoData) {
            this.mainDataInit();
        },
        yearItem: function (infoData) {
            this.mainDataInit();
        },
    },
    mounted() {
        this.mainDataInit();
    },
    methods: {
        mainDataInit() {
            this.mainData = [];
            this.infoData[21].map((i, o) => {
                if (i[0] == this.posItem) {
                    this.mainData = i[this.yearItem].split(',')
                }
            })
        }
    }
}
</script>

<style lang="scss" scoped>
.cl6 {
    width: 300px;
    height: 275px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;

    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 300px;
        height: 275px;
        z-index: 1;
        background-image: url('../../assets/denglukuang.png');
        background-repeat: no-repeat;
        background-size: 100% 100%;
        opacity: .4;
    }

    .main {
        position: relative;
        z-index: 2;
        width: 90%;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding-top: 20px;

        .m-i {
            font-family: 'YSBTH';
            position: relative;
            width: 120px;
            height: 200px;
            background-image: url('../../assets/xiaobeijing2.png');
            background-size: 100% 100%;

            img {
                width: 120px;
                height: 120px;
            }

            .m-ii1 {
                position: absolute;
                opacity: .4;
                z-index: 2;
                top: 15px;
            }

            .m-ii2 {
                position: absolute;
                opacity: .4;
                z-index: 2;
                top: 15px;
            }

            .m-ii3 {
                position: absolute;
                z-index: 1;
                width: 60px;
                height: 60px;
                left: calc(50% - 30px);
                top: calc(50% - 55px);
                animation: rotateAnimation 20s linear infinite;
            }

            p {
                position: absolute;
                z-index: 9;
                font-size: 60px;
                color: #E6A23C;
                text-shadow: 0 0 12px #000;
                width: 100%;
                text-align: center;
                height: 40px;
                top: calc(50% - 45px);
                line-height: 40px;
            }


            span {
                position: absolute;
                z-index: 9;
                text-shadow: 0 0 12px #000;
                color: #E6A23C;
                bottom: 20px;
                width: 150px;
                text-align: center;
                letter-spacing: 5px;
                font-size: 26px;
                left: -12px;
            }
        }

        .m-i:last-of-type {
            p {
                color: #F56C6C;
            }

            span {
                left: 0px;
                width: 100%;
                color: #F56C6C;
            }
        }
    }
}
</style>